package com.changdu.seatunnel.admin.pojo;

import java.text.ParseException;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;

import com.changdu.seatunnel.admin.config.enums.StartModeEnum;

import lombok.Data;

@Data
public class JobParams {
	
	private String type;
	
	// ---------- kafka -----------
    private StartModeEnum consumeMode = StartModeEnum.NONE;

    private String startTime;
    
    // ---------- mysql -----------
    private String binlogFile;
    
    public void setStartTime(String startTime) throws ParseException {
    	if (StringUtils.isNoneEmpty(startTime)) {
    		this.startTime = Long.toString(DateUtils.parseDate(startTime, "yyyy-MM-dd HH:mm:ss").getTime());
    	}
    }
    
    public void setConsumeMode(String consumeMode) {
    	this.consumeMode = StartModeEnum.fromCode(consumeMode);
    }
    
}